package com.cin.cma.server.biz.controller;


import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSON;
import com.cin.cma.common.model.ApiResponse;
import com.cin.cma.server.biz.model.core.client.OnlineCinemaDTO;
import com.cin.cma.server.biz.model.core.client.OnlineClientDTO;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * @Author：wubo
 * @Date：2025/2/18 下午6:37
 */
@RestController
@RequestMapping("/client")
@Slf4j
public class ClientController {

    @ResponseBody
    @PostMapping("/check")
    public ApiResponse<OnlineClientDTO> authCheck(@RequestBody @Valid OnlineCinemaDTO model) {
        log.info("有一个客户端前来验证 = " + JSON.toJSONString(model));
        //todo 以后改为读库，暂时直接返回成功
//        OnlineClientDTO result = this.jynettyClientService.authCheck(model);
        OnlineClientDTO result = new OnlineClientDTO();
        result.setAuthFlag(true);
        result.setExpireDate(DateUtil.offsetDay(new Date(), 300));
        return ApiResponse.success(result);
    }
}
